//
//  ZSVisitorController.m
//  微博-0C
//
//  Created by 周李波 on 16/7/19.
//  Copyright © 2016年 q. All rights reserved.
//

#import "ZSVisitorController.h"
#import "ZSVisitorView.h"
#import "ZSBarButtonItem.h"
#import "ZSOAuthController.h"

@interface ZSVisitorController ()

@property (nonatomic,strong)UITableView *tableView;



@end

@implementation ZSVisitorController

#pragma mark
#pragma mark - 导航栏按钮点击
- (void)loginButtonClick{
    ZSOAuthController *view = [ZSOAuthController new];
    
    [self presentViewController:[[UINavigationController alloc]initWithRootViewController:view] animated:YES completion:nil];
}

#pragma mark
#pragma mark - 加载视图完成
- (void)viewDidLoad {
    [super viewDidLoad];
    

}

#pragma mark
#pragma mark - 加载视图
- (void)loadView{
//    self.islogin = YES;
    [self setupUI];
    if (self.islogin) {
        self.view = self.tableView;
        
    }else{
        self.view = self.visitorView;
        self.navigationItem.leftBarButtonItem = [ZSBarButtonItem itemWithImageName:nil title:@"登陆" target:self action:@selector(loginButtonClick)];
        self.navigationItem.rightBarButtonItem = [ZSBarButtonItem itemWithImageName:nil title:@"注册" target:self action:@selector(loginButtonClick)];
    }
}

#pragma mark
#pragma mark - 设置UI
- (void)setupUI{
    UITableView *tableView = [[UITableView alloc]init];
    self.tableView = tableView;
    ZSVisitorView *visitorView = [[ZSVisitorView alloc]init];
    self.visitorView = visitorView;
    visitorView.visitorBlock = ^{
        [self loginButtonClick];
    };
    
}

@end
